package utils

import (
	"sanrenx.com/xyxf/pkg/setting"
)

/**
 * @Description: 获取Page参数
 * @param c
 * @return int 起始下标
 * @return int 每页数量
 */
func GetPage(page int) (int, int) {
	offset := 0
	if page > 0 {
		offset = (page - 1) * setting.AppSetting.PageSize
	}

	return offset, setting.AppSetting.PageSize
}

func GetPageSize(page int, size int) (int, int) {
	offset := 0
	//设置默认size
	if size <= 0 {
		size = setting.AppSetting.PageSize
	}

	if page > 0 {
		offset = (page - 1) * size
	}

	return offset, size
}
